package com.pig4cloud.pigx.shop.user.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.shop.user.api.dto.CustomToUserOrderSummaryDTO;
import com.pig4cloud.pigx.shop.user.api.dto.CustomToUserSummaryDTO;
import com.pig4cloud.pigx.shop.user.service.ShopUserSummaryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/user/summary")
@Tag(description = "shop_user_summary", name = "商城用户统计")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ShopUserSummaryController {

	private final ShopUserSummaryService shopUserSummaryService;

	/**
	 * 根据销售代表获取下级用户数量
	 * @param page
	 * @param customToUserSummaryDTO
	 * @return
	 */
	@Operation(summary = "分页查询", description = "分页查询")
	@GetMapping("/getCustomToUserSummary")
	public R getCustomToUserSummary(Page page, CustomToUserSummaryDTO customToUserSummaryDTO){
		return R.ok(shopUserSummaryService.getCustomToUserSummary(page, customToUserSummaryDTO));
	}

	/**
	 * 获取详情
	 * @param customToUserSummaryDTO
	 * @return
	 */
	@Operation(summary = "分页查询", description = "分页查询")
	@PostMapping("/getCustomToUserDetail")
	public R getCustomToUserDetail(@RequestBody CustomToUserSummaryDTO customToUserSummaryDTO){
		return R.ok(shopUserSummaryService.getCustomToUserDetail(customToUserSummaryDTO));
	}

	/**
	 * 获取详情
	 * @param customToUserOrderSummaryDTO
	 * @return
	 */
	@Operation(summary = "分页查询", description = "分页查询")
	@GetMapping("/getCustomToUserOrderSummary")
	public R getCustomToUserOrderSummary(CustomToUserOrderSummaryDTO customToUserOrderSummaryDTO){
		return R.ok(shopUserSummaryService.getCustomToUserOrderSummary(customToUserOrderSummaryDTO));
	}

	/**
	 * 获取详情
	 * @param customToUserOrderSummaryDTO
	 * @return
	 */
	@Operation(summary = "分页查询", description = "分页查询")
	@PostMapping("/getCustomToUserOrderDetail")
	public R getCustomToUserOrderDetail(@RequestBody CustomToUserOrderSummaryDTO customToUserOrderSummaryDTO){
		return R.ok(shopUserSummaryService.getCustomToUserOrderDetail(customToUserOrderSummaryDTO));
	}

}
